local skel = fk.CreateSkill{
  name = "knu__poshi",
}

local KleeU = require "packages/klee_xy_I/utility/k_utility"

Fk:loadTranslationTable{
  ["knu__poshi"] = "破示",
  [":knu__poshi"] = "当你成为即时牌的目标时，你将手牌数调整至体力值；若你因此弃置伤害牌，则你下次发动时，改为调整至体力上限。",

  ["@@knu__poshi"] = "破示",

  ["$knu__poshi1"] = "我之忠心，可破示天地也！",
  ["$knu__poshi2"] = "诸天明鉴，我绝无二心啊！",

}


skel:addEffect(fk.TargetConfirming,{
  can_trigger = function (self, event, target, player, data)
    return player:hasSkill(skel.name) and target == player and (data.card.type == Card.TypeBasic or data.card:isCommonTrick()) and player.hp ~= player:getHandcardNum()
  end,
  on_cost = Util.TrueFunc,
  on_use = function (self, event, target, player, data)
    local n = player:getHandcardNum() > player.hp
    local max = player.hp
    if player:getMark("@@knu__poshi") > 0 then
      max = player.maxHp
      player.room:setPlayerMark(player,"@@knu__poshi",0)
    end
    local cards = KleeU.adjustHandCards(player, max, skel.name) --摸弃
    if n then
      if table.find(cards,function (cid)
        return Fk:getCardById(cid).is_damage_card
      end) then
        player.room:setPlayerMark(player,"@@knu__poshi",1)
      end
    end
  end,
})

return skel